package lab03.test01;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

/**
 * Created by dell on 2017/11/16.
 */
public class Test01 {

    public static void main(String[] args) {
        String path="D:\\hello.txt";
        BufferedReader reader=null;

        try {
            reader=new BufferedReader(new FileReader(path));
            //先写BurreredReader reader=new BudfferedReader，
            // 报错后按alt+enter，会自动出现try，catch

            String line=null;
            try {
                line =reader.readLine();

            } catch (IOException e) {
                e.printStackTrace();
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }finally {

            try {
                reader.close();
                //先输入reader.close，然后返回上面将BuffreerReader等于空值，然后按alt+enter
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
